package com.zn.tools;

import com.zn.pojo.RecordElement;
import com.zn.pojo.ServiceRecord;
import com.zn.pojo.UserRecord;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @Description
 * @Author zhaoning
 * @Date 2024/7/22
 */
public class MyTools {
    public static List<RecordElement> getMessages(List<UserRecord> userRecordList, List<ServiceRecord> serviceRecordList) {
        List<RecordElement> res = new ArrayList<>();

        for (int i = 0, j = 0, idx = 0; idx < serviceRecordList.size() + userRecordList.size(); idx++) {
            if (idx % 2 == 0) {
                res.add(RecordElement.toRE(userRecordList.get(i)));
                i++;
            } else {
                res.add(RecordElement.toRE(serviceRecordList.get(j)));
                j++;
            }
        }

        return res;
    }
}
